package problem111;

//111.二叉树的最小深度
//https://leetcode.cn/problems/minimum-depth-of-binary-tree/

class Solution {
    public int minDepth(TreeNode root) {
        if(root == null) return 0;
        int l = minDepth(root.left);
        int r = minDepth(root.right);
        if(l == 0 && r == 0) {
        }else {
            if(l == 0) l = 0x3f3f3f3f;
            if(r == 0) r = 0x3f3f3f3f;
        }
        return Math.min(l, r) + 1;
    }
}